1. Technical Field
The depicted illustrative embodiment relates to data processing systems, and in particular to efficiently selecting optimized object code instructions within an optimized listing to be associated with source code instructions which were compiled by an optimizing compiler to generate the object code instructions. Still more particularly, the depicted illustrative embodiment relates to a method and system in a data processing system for comparing one of a plurality of object code instructions with a second plurality of object code instructions where the second plurality of object code instructions are all located after one object code instruction in an optimized listing of the plurality of object code instructions in order to efficiently select optimized object code instructions within the listing to be associated with source code instructions.
2. Description of the Related Art
In order for a computer to be able to execute a computer program written in a high-level language, the program must be compiled. The program includes the high-level language instructions, in a particular order, chosen by a programmer. These high-level instructions are also called the source code instructions.
When a program is compiled, the source code instructions are translated into machine instructions. The machine instructions are also called object code instructions. Therefore, source code is compiled into object code. Each source code instruction will typically have one or more associated object code instructions. Some source code instructions will not be associated with any object code because the source code may be a comment or because the compiler was unable for various reasons to compile that particular source code instruction.
As a result of the compilation, a listing may be created which includes the object code instructions in a particular sequence which is related to the sequence of the associated source code instructions. The listing can be used by the programmer to debug the program, investigate performance problems, and analyze the quality of the compiled object code, among other things.
In order to better analyze the listing, a programmer may desire to have source code instructions printed along with the object code instructions. One known technique for accomplishing this has been to associate a line number with each line of source code. Prior to printing the listing, each line of source code is printed along with the line's associated line number. Then, the listing of object code instructions is printed. Each line of object code is associated with one line of source code, and thereby also associated with the line number of that line of source code. Each line of object code is then printed along with the associated line number. However, because all of the source code is printed before all of the object code, it may be very difficult, especially in large programs, to quickly view an object code instruction and its associated source code instruction.
Another technique is to include source code instructions within the listing. Therefore, a line of source code may be printed between several lines of the object code included within the listing. A line of source code may be printed immediately prior to the lines of object code generated by compiling that line of source code.
A problem exists with this method, however, when an optimizing compiler is utilized to compile the source code. An optimizing compiler compiles the source code into object code and then may rearrange the sequence of the object code instructions to produce optimized object code which will be processed faster by the data processing system. The listing generated by the optimizing compiler will include object code instructions in the new, optimized, sequence. The new, optimized sequence may have little resemblance to the original sequence of the source code. Therefore, it becomes very cumbersome to print source code instructions along with a listing of optimized object code instructions.
Therefore a need exists for a method and system to efficiently select optimized object code instructions to be associated with source code instructions which were compiled utilizing an optimizing compiler to generate the object code instructions.